package com.huawei.service.impl;

import com.huawei.dao.SpfenleiMappr;
import com.huawei.entity.Spfenlei;
import com.huawei.service.SpfenleiService;
import com.huawei.service.SpuService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * @ClassName SpfenleiImpl
 * @Description TODO
 * @Author 快乐的大胖
 * @Date 2021/12/6 16:50
 */
@Service
public class SpfenleiImpl implements SpfenleiService {


    @Resource
    SpfenleiMappr spfenleiMappr;

    @Override
    public List<Spfenlei> selectAll(Map<String, Object> pars) {

        List<Spfenlei> list =spfenleiMappr.getid(0);

        for(Spfenlei n:list){
            n.setA(spfenleiMappr.getid(n.getId()));
            for(Spfenlei n1:n.getA()){
                n1.setA(spfenleiMappr.getid(n1.getId()));
            }
        }
        return list ;
    }



    @Override
    public int insert(Spfenlei spfenlei) {
        return spfenleiMappr.insert(spfenlei);
    }

    @Override
    public int update(Spfenlei spfenlei) {
        return spfenleiMappr.update(spfenlei);
    }

    @Override
    public int delete(int id) {
        return spfenleiMappr.delete(id);
    }
}
